home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1989 …il & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / MPW Goodies / Interfaces / CIncludes / Picker.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-11-30  |  2.8 KB  |  96 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Tuesday, October 4, 1988 at 7:27 PM
  4.     Picker.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.     Copyright Apple Computer, Inc.  1987-1988
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PICKER__
  15. #define __PICKER__
  16.  
  17. #ifndef __QUICKDRAW__
  18. #include <Quickdraw.h>
  19. #endif
  20.  
  21. #define MaxSmallFract 0x0000FFFF    /*Maximum small fract value, as long*/
  22.  
  23.  
  24. /* A SmallFract value is just the fractional part of a Fixed number,
  25. which is the low order word.  SmallFracts are used to save room,
  26. and to be compatible with Quickdraw's RGBColor.  They can be
  27. assigned directly to and from INTEGERs. */
  28.  
  29. typedef unsigned short SmallFract;  /* Unsigned fraction between 0 and 1 */
  30.  
  31. /* For developmental simplicity in switching between the HLS and HSV
  32. models, HLS is reordered into HSL.  Thus both models start with
  33. hue and saturation values; value/lightness/brightness is last. */
  34.  
  35.  
  36.  
  37. struct HSVColor {
  38.     SmallFract hue;                 /*Fraction of circle, red at 0*/
  39.     SmallFract saturation;          /*0-1, 0 for gray, 1 for pure color*/
  40.     SmallFract value;               /*0-1, 0 for black, 1 for max intensity*/
  41. };
  42.  
  43. #ifndef __cplusplus
  44. typedef struct HSVColor HSVColor;
  45. #endif
  46.  
  47. /* For developmental simplicity in switching between the HLS and HSVmodels, HLS is reordered
  48.  into HSL.  Thus both models start with hue and saturation values; value/lightness/brightness is last. */
  49. struct HSLColor {
  50.     SmallFract hue;                 /*Fraction of circle, red at 0*/
  51.     SmallFract saturation;          /*0-1, 0 for gray, 1 for pure color*/
  52.     SmallFract lightness;           /*0-1, 0 for black, 1 for white*/
  53. };
  54.  
  55. #ifndef __cplusplus
  56. typedef struct HSLColor HSLColor;
  57. #endif
  58.  
  59. struct CMYColor {
  60.     SmallFract cyan;
  61.     SmallFract magenta;
  62.     SmallFract yellow;
  63. };
  64.  
  65. #ifndef __cplusplus
  66. typedef struct CMYColor CMYColor;
  67. #endif
  68.  
  69. #ifdef __safe_link
  70. extern "C" {
  71. #endif
  72. pascal SmallFract Fix2SmallFract(Fixed f)
  73.     = {0x3F3C,0x0001,0xA82E}; 
  74. pascal Fixed SmallFract2Fix(SmallFract s)
  75.     = {0x3F3C,0x0002,0xA82E}; 
  76. pascal void CMY2RGB(const CMYColor *cColor,RGBColor *rColor)
  77.     = {0x3F3C,0x0003,0xA82E}; 
  78. pascal void RGB2CMY(const RGBColor *rColor,CMYColor *cColor)
  79.     = {0x3F3C,0x0004,0xA82E}; 
  80. pascal void HSL2RGB(const HSLColor *hColor,RGBColor *rColor)
  81.     = {0x3F3C,0x0005,0xA82E}; 
  82. pascal void RGB2HSL(const RGBColor *rColor,HSLColor *hColor)
  83.     = {0x3F3C,0x0006,0xA82E}; 
  84. pascal void HSV2RGB(const HSVColor *hColor,RGBColor *rColor)
  85.     = {0x3F3C,0x0007,0xA82E}; 
  86. pascal void RGB2HSV(const RGBColor *rColor,HSVColor *hColor)
  87.     = {0x3F3C,0x0008,0xA82E}; 
  88. pascal Boolean GetColor(Point where,const Str255 prompt,const RGBColor *inColor,
  89.     RGBColor *outColor)
  90.     = {0x3F3C,0x0009,0xA82E}; 
  91. #ifdef __safe_link
  92. }
  93. #endif
  94.  
  95. #endif
  96.